package com.xm.servlet.background.commodity;

import com.xm.service.background.CommodityService;
import lombok.SneakyThrows;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


/**
 * 修改商品名称
 * @author 康文程
 * @date 2024-1-18
 */
@WebServlet("/background/update/commodity/name")
public class UpdateCommodityNameServlet extends HttpServlet {
    private final CommodityService service = new CommodityService();
    @SneakyThrows
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp)  {
        String name = req.getParameter("name");
        String commodityId = req.getParameter("commodityId");
        resp.getWriter().print(service.updateCommodityNameById(Integer.parseInt(commodityId),name));
    }
}
